using MiniExcelLibs.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AttendanceSysytem.Models
{
    /// <summary>
    /// 导入考勤记录
    /// </summary>
    public class Import_WorkAttendanceRecords
    {
        /// <summary>
        /// 考勤日期
        /// </summary>
        [ExcelColumnIndex("A")]
        public string Date_Text { get; set; }
        /// <summary>
        /// 员工姓名
        /// </summary>
        [ExcelColumnIndex("B")]
        public string EmployeeName { get; set; }
        /// <summary>
        /// 账号
        /// </summary>
        [ExcelColumnIndex("C")]
        public string Account { get; set; }
        /// <summary>
        /// 员工部门文本 ，示例：上海锴士智能科技有限公司/运营中心/生产部/钳工组/钳工二组
        /// </summary>
        [ExcelColumnIndex("D")]
        public string Depart_Text { get; set; }
        /// <summary>
        /// 职务
        /// </summary>
        [ExcelColumnIndex("E")]
        public string Job { get; set; }
        /// <summary>
        /// 所属规则: 办公室 、 车间
        /// </summary>
        [ExcelColumnIndex("F")]
        public string RuleText { get; set; }


        /// <summary>
        /// 排班班次,eg : 休息 、 -- 、08:30-11:30、12:30-17:30
        /// </summary>
        [ExcelColumnIndex("G")]
        public string WorkScheduling { get; set; }
        /// <summary>
        /// 最早打卡时间
        /// </summary>
        [ExcelColumnIndex("H")]
        public string EarliestText { get; set; }

        /// <summary>
        /// 最晚打卡时间
        /// </summary>
        [ExcelColumnIndex("I")]
        public string LatestText { get; set; }
        /// <summary>
        /// 校准状态
        /// </summary>
        [ExcelColumnIndex("N")]
        public string CalibrationConditionText { get; set; }
        [ExcelColumn(Ignore = true)]
        public string Depart { get; internal set; }
    }

    public class Import_WorkAttendanceDetailRecords
    {
        /// <summary>
        /// 日期
        /// </summary>
        [ExcelColumnIndex("A")]
        public string Date_Text { get; set; }
        /// <summary>
        /// 姓名
        /// </summary>
        [ExcelColumnIndex("B")]
        public string EmployeeName { get; set; }
        /// <summary>
        /// 账号
        /// </summary>
        [ExcelColumnIndex("C")]
        public string Account { get; set; }
        /// <summary>
        /// 员工部门文本 ，示例：上海锴士智能科技有限公司/运营中心/生产部/钳工组/钳工二组
        /// </summary>
        [ExcelColumnIndex("D")]
        public string Depart_Text { get; set; }
        /// <summary>
        /// 职务
        /// </summary>
        [ExcelColumnIndex("E")]
        public string Job { get; set; }
        /// <summary>
        /// 所属规则: 办公室 、 车间
        /// </summary>
        [ExcelColumnIndex("F")]
        public string RuleText { get; set; }
        /// <summary>
        /// 打卡类型
        /// </summary>
        [ExcelColumnIndex("G")]
        public string Type { get; set; }
        /// <summary>
        /// 实际打卡时间
        /// </summary>
        [ExcelColumnIndex("I")]
        public string ReailtyText { get; set; }
        /// <summary>
        /// 打卡地点
        /// </summary>
        [ExcelColumnIndex("K")]
        public string CheckInLocation { get; set; }
    }

    public class Import_OuterWorkAttendanceRecords
    {
        /// <summary>
        /// 考勤日期
        /// </summary>
        [ExcelColumnIndex("A")]
        public string Date_Text { get; set; }
        /// <summary>
        /// 员工姓名
        /// </summary>
        [ExcelColumnIndex("B")]
        public string EmployeeName { get; set; }
        /// <summary>
        /// 账号
        /// </summary>
        [ExcelColumnIndex("C")]
        public string Account { get; set; }
        /// <summary>
        /// 员工部门文本 ，示例：上海锴士智能科技有限公司/运营中心/生产部/钳工组/钳工二组
        /// </summary>
        [ExcelColumnIndex("D")]
        public string Depart_Text { get; set; }

        /// <summary>
        /// 最早打卡时间
        /// </summary>
        [ExcelColumnIndex("E")]
        public string EarliestText { get; set; }

        /// <summary>
        /// 最晚打卡时间
        /// </summary>
        [ExcelColumnIndex("F")]
        public string LatestText { get; set; }
        /// <summary>
        /// 打开次数
        /// </summary>
        [ExcelColumnIndex("G")]
        public int ClockinTimes { get; set; }
        /// <summary>
        /// 上班打卡地点
        /// </summary>
        [ExcelColumnIndex("I")]
        public string CheckInEarliestLocation { get; set; }
        /// <summary>
        /// 下班打卡地点
        /// </summary>
        [ExcelColumnIndex("L")]
        public string CheckInLatestLocation { get; set; }

    }

    /// <summary>
    /// 计算员工打卡情况
    /// </summary>
    public class Calc_EmployeeWorkAttendanceRecords
    {
        public string EmployeeName { get; set; }
        public string Account { get; set; }
        public string Depart_Text { get; set; }
        //打卡规则
        public string ClockRule { get; set; }

        public List<EmployeeAttendanceDetails> AttendanceDetails { get; set; } = new List<EmployeeAttendanceDetails>();
        /// <summary>
        /// 实际出勤天数
        /// </summary>
        public int RealWorkDay { get; set; }

        public int StandardWorkDay { get; set; }

        /// <summary>
        /// 实际饭补
        /// </summary>
        public int TotalFoodTimes { get; set; }

        /// <summary>
        /// 休息日加班时间
        /// </summary>
        public decimal RestDayOvertimeHour { get; set; }
        /// <summary>
        /// 工作日加班时间
        /// </summary>
        public decimal WorkDayOvertimeHour { get; set; }
        /// <summary>
        /// 总病假时间
        /// </summary>
        public double TotalSickLeaveTimes { get; set; }
        /// <summary>
        /// 总丧假时间
        /// </summary>
        public double TotalBereavementLeaveTimes { get; set; }
        /// <summary>
        /// 总调休时间
        /// </summary>
        public double TotalRestLeaveTimes { get; set; }
        /// <summary>
        /// 总事假
        /// </summary>
        public double TotalAffairsLeaveTimes { get; set; }
        /// <summary>
        /// 总年假
        /// </summary>
        public double TotalAnnualLeaveTimes { get; set; }
        /// <summary>
        /// 迟到
        /// </summary>
        public int BeLateCount { get; set; }
        /// <summary>
        /// 总迟到时间
        /// </summary>
        public double TotalLateTimes { get; set; }
        /// <summary>
        /// 漏打卡
        /// </summary>
        public int MissedPunch { get; set; }
        /// <summary>
        /// 未打卡
        /// </summary>
        public int NoCardPunched { get; set; }
    }

    public class EmployeeAttendanceDetails
    {
        public string Account { get; set; }

        /// <summary>
        /// 当日状态 1 正常上班 2 外出  3 无班次但是有考勤时间  4休息 
        /// </summary>
        public int WorkType { get; set; } = 1;
        /// <summary>
        /// 是否外出
        /// </summary>
        public bool IsOut { get; set; }
        /// <summary>
        /// 工作日期
        /// </summary>
        public DateTime WorkDate { get; set; }



        /// <summary>
        /// 上班打卡时间
        /// </summary>
        public DateTime? EarliestTime { get; set; }

        /// <summary>
        /// 下班打卡时间
        /// </summary>
        public DateTime? LatestTime { get; set; }

        /// <summary>
        /// 校准状态
        /// </summary>
        public string CalibrationConditionText { get; set; }

        /// <summary>
        /// 上班打卡地点
        /// </summary>
        public string CheckInEarliestLocation { get; set; }

        /// <summary>
        /// 下班打卡地点
        /// </summary>
        public string CheckInLatestLocation { get; set; }
    }

}
